Entertainer has a cache almost for every data type that it handles including
images, videos, music, feeds, tv-guide and recordings. All caches are
implemented as SQLite databases. Every cache is stored in it's own file that
has \texttt{db} extension. Caches are stored in the following directory:
\texttt{$\sim$/.entertainer/cache}.

\subsection{Descriptions}

\subsubsection{Image cache}
Image cache contains all information of the images. It has two tables:
\texttt{Image} and \texttt{Album}. Album has a title and description and it
contains images. Image table contains information on images. One row matches
to one file. Entertainer considers folder as an album and images in that folder
belog to that album. Subfolder are own albums and there is no deep hierarcy in
image cache. In figure \ref{fig:image_er} is ER-diagram of the image cache database.
This database is stored in \texttt{$\sim$/.entertainer/cache/image.db}.

\subsubsection{Music cache}
Music cache contains everything related to the music library. Entertainer's
music library contains Albums, Tracks, Artists and Playlists. All this data
is stored in music cache database, which is stored in 
\texttt{$\sim$/.entertainer/cache/music.db} -file. In figure \ref{fig:music_er}
you can see the structure of the cache. As you can see, there is only \texttt{Track}
and \texttt{Playlist} tables. MusicLibrary handels the abstraction of albums and
artists. This cache is created in \texttt{backend/components/mediacache/music\_cache.py}.

\subsubsection{Video cache}
Video cache contains information on video files. These do NOT include recorded
TV-shows, but only the files that are in video library. Video cache contains two
tabels \texttt{videofile} and \texttt{metadata} (actually these should be merged).
\texttt{Videofile} table contains basic information on video and \texttt{metadata} 
some extrnal information. Metadata table contains type field, which determinse
the type of the videofile. Allowed values are \texttt{MOVIE}, \texttt{CLIP} and 
\texttt{TV-SERIES}. According to this field the video is represnted as a 
\texttt{Movie}, \texttt{TVEpisode} or \texttt{VideoClip} object in VideoLibrary 
(client side). This cache database is stored in \texttt{$\sim$/.entertainer/cache/video.db}.
In figure \ref{fig:video_er}

\subsubsection{Feed cache}
Feed cache includes all feeds and entries of those feeds. Entry is a one ''post''
of the feed. Backend fetches feeds time to time and updates the cache. Cache keeps
up to 50 entries per feed. In figure \ref{fig:feed_er} you can see the structure
of the Feed cache. Cache is stored in \texttt{$\sim$/.entertainer/cache/feed.db}

\subsection{ER-diagrams}
\begin{comment}

\begin{figure}[htb]
	\begin{center}
		\includegraphics[angle=0,scale=0.6]{diagrams/ER/image_library_er.png}
		\caption{ER-diagram of the image cache.}
		\label{fig:image_er}
	\end{center}
\end{figure}

\begin{figure}[htb]
	\begin{center}
		\includegraphics[angle=0,scale=0.6]{diagrams/ER/music_library_er.png}
		\caption{ER-diagram of the music cache.}
		\label{fig:music_er}
	\end{center}
\end{figure}

\begin{figure}[htb]
	\begin{center}
		\includegraphics[angle=0,scale=0.6]{diagrams/ER/feed_library_er.png}
		\caption{ER-diagram of the video cache.}
		\label{fig:video_er}
	\end{center}
\end{figure}

\begin{figure}[htb]
	\begin{center}
		\includegraphics[angle=0,scale=0.6]{diagrams/ER/feed_library_er.png}
		\caption{ER-diagram of the feed cache.}
		\label{fig:feed_er}
	\end{center}
\end{figure}
\end{comment}
